home *** CD-ROM | disk | FTP | other *** search
- name execbeep
-
- dp equ dword ptr
- of equ offset
-
- code segment
- assume cs:code, ds:code
- org 100h
-
- begin: jmp start
-
- beep proc ; beep the speaker
- push ax ; save
- push cx
- in al,97 ; get port values
- and al,0feh ; turn speaker on
- out 97,al
- mov cx,bx ; cycles to cx
- more_sound: push cx ; save cycles
- xor al,2 ; flip push/pull
- out 97,al
- mov cx,dx ; wait
- part1: loop part1
- xor al,2 ; flip push/pull
- out 97,al
- mov cx,dx ; wait
- part2: loop part2
- pop cx
- loop more_sound
- pop cx ; restore
- pop ax
- ret
- beep endp
-
- beep_low proc
- push bx
- push dx
- mov bx,50 ; number of cycles
- mov dx,100 ; half cycle time
- call beep
- pop dx
- pop bx
- ret
- beep_low endp
-
- beep_high proc
- push bx
- push dx
- mov bx,100 ; number of cycles
- mov dx,50 ; half cycle time
- call beep
- pop dx
- pop bx
- ret
- beep_high endp
-
- ; +++ EDR 2/27/88
-
- space db ' ',0 ; just a space
- cr_lf db 13,10,0 ; carriage return/line feed
-
- tty_str proc ; show string in ES:SI, max of CX chars
-
- jmp short load ; make sure string isn't null
-
- write: mov ah,0EH ; write TTY service (char in AL)
- int 10H ; kick BIOS
-
- inc si ; point to next char
- dec cx ; and decrement count
-
- load: mov al,es:[si] ; load char to show
- or al,al ; is it end of asciiz string?
- jz done ; yes
- cmp cx,0 ; did we reach max char count?
- jnz write ; no- write it
-
- done: ret
-
- tty_str endp
-
- show_cmd proc ; show the exec command line
-
- push ax ; save the world
- push cx
- push dx
- push si
- push di
- push es
- push bx
-
- mov ax,ds ; show command name from ds:dx
- mov es,ax
- mov si,dx
- mov cx,64
- call tty_str
- mov ax,cs ; followed by a space (just in case)
- mov es,ax
- mov si,offset space
- mov cx,64
- call tty_str
-
- pop bx ; get original es:bx back
- pop es
- push es
- push bx
-
- mov si,es:[bx+2] ; set es:si to command arguments
- mov ax,es:[bx+4]
- mov es,ax
-
- mov cl,es:[si] ; get char count in cx
- xor ch,ch
- inc si ; skip to actual command chars
- call tty_str ; and show 'em
-
- mov ax,cs ; skip up a line
- mov es,ax
- mov si,offset cr_lf
- mov cx,64
- call tty_str
-
- pop bx ; restore the world
- pop es
- pop di
- pop si
- pop dx
- pop cx
- pop ax
-
- ret ; back to caller
-
- show_cmd endp
-
- ; --- EDR
-
- old_int21 dw 2 dup(?); former int 21h address
-
- new_int21 proc far
- cmp ah,4bh ; EXEC function?
- je exec_beep ; yes, beep, then call EXEC
- cmp ah,4dh ; request to get return code?
- je retc_beep ; yes, beep then get return code
- jmp dp cs:old_int21 ; no, pass it on
-
- exec_beep: call beep_low ; beep before EXEC
- call show_cmd ; show the command (EDR)
- jmp dp cs:old_int21 ; go do EXEC
-
- retc_beep: call beep_high ; beep after EXEC
- jmp dp cs:old_int21 ; go get return code
- new_int21 endp
-
- start: mov ax,3521h ; get int 21h
- int 21h
- mov old_int21,bx ; store offset
- mov old_int21+2,es ; store segment
- mov dx,of new_int21 ; ds:dx -> new int 21h
- mov ax,2521h
- int 21h
- mov dx,of start ; discard excess
- add dx,0fh
- shr dx,1
- shr dx,1
- shr dx,1
- shr dx,1
- mov ax,3100h ; keep process
- int 21h
-
- code ends
- end begin
-